from django.db import models


class EachTestType(models.Model):
    type_name = models.CharField(max_length=30)

    def __str__(self):
        return self.type_name


# Create your models here.
class EachTest(models.Model):
    title = models.CharField(max_length=30)
    test_type = models.ForeignKey(EachTestType, on_delete=models.DO_NOTHING)
    created_time = models.DateTimeField(auto_now_add=True)

    physical_block = models.IntegerField(default=0)
    page_cf_num = models.IntegerField(default=0)
    page_queen_len = models.IntegerField(default=0)
    page_fault_rate = models.IntegerField(default=0)
    show_res_bool = models.IntegerField(default=0)

    def __str__(self):
        return "<Test: %s>" % self.title

    class Meta:
        ordering = ['-created_time']
